import request from '@/utils/request'

export function Get(id, args) {
  return request({
    url: `/orders/api/serverstatus_index/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

export function Post(data) {
  return request({
    url: '/orders/api/serverstatus_index/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function Put(id, data) {
  return request({
    url: `/orders/api/serverstatus_index/${id || ''}`,
    headers: { 'content-type': 'application/json' },
    method: 'put',
    data: JSON.stringify(data)
  })
}

export function Delete(id) {
  return request({
    url: `/orders/api/serverstatus_index/${id || ''}`,
    method: 'delete'
  })
}

export function Sync(id) {
  return request({
    url: `/orders/api/serverstatus_sync/${id || ''}`,
    method: 'post'
  })
}

export function LiveStatus(id, data) {
  return request({
    url: `/orders/api/serverstatus_livestatus/${id || ''}`,
    method: 'post',
    data: data
  })
}

export function CreateBackup(id, data) {
  return request({
    url: `/orders/api/serverstatus_create_backup/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function CreateNewWebsite(id, data) {
  return request({
    url: `/orders/api/serverstatus_create_website/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function DeleteWebsite(id, data) {
  return request({
    url: `/orders/api/serverstatus_delete_website/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function InstallWebsite(id, data) {
  return request({
    url: `/orders/api/serverstatus_install_website/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function PsInitTheme(id, data) {
  return request({
    url: `/orders/api/serverstatus_init_theme/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function Lnssl(id, data) {
  return request({
    url: `/orders/api/serverstatus_lnssl/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function GetPrestashopConfigDbName(id, data) {
  return request({
    url: `/orders/api/serverStatus_getconfig_dbname/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function ModifyPrestashopConfigDbName(id, data) {
  return request({
    url: `/orders/api/serverStatus_modifyconfig_dbname/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function DropPrestashopDB(id, data) {
  return request({
    url: `/orders/api/serverStatus_drop_dbname/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function GoogleDomainVerify(id, data) {
  return request({
    url: `/orders/api/googledomainverify/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function LoadServerFile(id, data) {
  return request({
    url: `/orders/api/loadserverfile/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function WriteServerFile(id, data) {
  return request({
    url: `/orders/api/writeserverfile/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function RunWpSqlReplace(data) {
  return request({
    url: `/orders/api/sswprsq/`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function CleanServer(data) {
  return request({
    url: `/orders/api/cleanserver/`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}

export function AddXmlrpcSecurity(id, data) {
  return request({
    url: `/orders/api/serverstatus_add_xmlrpc_security/${id || ''}`,
    method: 'post',
    data: data,
    timeout: 100000000
  })
}
